//
//  RealHouseListVC.m
//  Utils
//
//  Created by enghou on 2018/7/2.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

#import "RealHouseListVC.h"
#import "HouseItemModel.h"
@interface RealHouseListVC ()

@end

@implementation RealHouseListVC
-(instancetype)init{
    self = [super init];
    if (self) {
        self.path = @"/mobile/comprehensiveGovernance/houseInfo/findHouseInfoPage.action";
        self.modelClsName = @"HouseItemModel";
    }
    return self;
}

-(NSDictionary *)param{
    return @{@"rows":@"10",@"page":[NSString stringWithFormat:@"%li",self.page]};
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.rightBarButtonItem = nil;
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [self beginLoading];
    HouseItemModel *model = self.source[indexPath.row];
    [[NetWorkerManager sharedInstance]postWithPath:@"/mobile/comprehensiveGovernance/builddatas/bindHouseInfo.action" parameter:@{@"houseId":model.ids,@"layoutRow":[NSString stringWithFormat:@"%li",self.model.layoutRow],@"layoutColumn":[NSString stringWithFormat:@"%li",self.model.layoutColumn],@"id":self.model.ids} completeBlock:^(NSDictionary *source) {
        [self endLoading];
        BaseModel *model = [[BaseModel alloc]initWithSourceDict:source];
        if (model.success) {
            [self pop];
            [[NSNotificationCenter defaultCenter]postNotificationName:@"RefreshLayout" object:self.model];
        }else{
            [self alertSome:model.msg];
        }
    } failBlock:^(NSInteger code) {
        [self alertSome:kNetWorkFail];
    }];
}

@end
